<!DOCTYPE html>
<html class="app">
<head>
    <meta charset="utf-8" />
    <meta name="renderer" content="webkit" />
    <title>登录 | {{config.setup.WEB_SITE_TITLE}} - 后台管理</title>
    <meta name="description" content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <link rel="stylesheet" href="/static/admin/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="/static/admin/css/animate.css" type="text/css" />
    <link rel="stylesheet" href="/static/admin/css/font.css" type="text/css" />
    <link rel="stylesheet" href="/static/admin/fonts/cmswingico/iconfont.css" />
    <link rel="stylesheet" href="/static/admin/css/app.css" type="text/css" />
    <link rel="stylesheet" href="/static/admin/js/toastr/toastr.min.css" type="text/css"/>
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script src="/static/admin/js/ie/html5shiv.js"></script>
    <script src="/static/admin/js/ie/respond.min.js"></script>
    <script src="/static/admin/js/ie/excanvas.js"></script>
    <![endif]-->
    <script src="/static/admin/js/jquery.min.js"></script>
    <script src="/static/admin/js/toastr/toastr.min.js"></script>
    <script src="/static/admin/js/slimscroll/jquery.slimscroll.min.js"></script>
</head>
<body class="bg-info dker ">
<section id="content" class="m-t-lg wrapper-md animated fadeInUp ">
    <div class="container aside-xl">
        <a class="navbar-brand block" href="/index"><i class="iconfont icon-cmswing-o" style="font-size:5em"></i></a>
        <section class="m-b-lg">
            <header class="wrapper text-center">
                <strong>管理员登陆</strong>
            </header>
            {%if HOOK@signinView%}
            {{HOOK@signinView|safe}}
            {%else%}
            <form action="#" method="post" >
                <div class="form-group">
                    <input id="username" type="username" name="username" placeholder="用户名" class="form-control rounded input-lg text-center no-border">
                </div>
                <div class="form-group">
                    <input id="password" type="password" name="password" placeholder="密码" class="form-control rounded input-lg text-center no-border">
                </div>
                <button type="submit" class="btn btn-lg btn-warning lt b-white b-2x btn-block btn-rounded" id="validate-submit">
                    <i class="icon-arrow-right pull-right"></i><span class="m-r-n-lg">登录</span></button>
                <div class="text-center m-t m-b"><a href="#"><small>忘记密码?</small></a></div>
                <!--<div class="line line-dashed"></div>-->
                <!--<p class="text-muted text-center"><small>Do not have an account?</small></p>-->
                <!--<a href="signup.html" class="btn btn-lg btn-info btn-block rounded">Create an account</a>-->
            </form>
            <script>
              $('#validate-submit').click(function () {
                var self = this;
                $(self).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
                $.ajax({
                  url: '/admin/public/signin',
                  type: 'POST',
                  dataType: 'json',
                  data: {
                    username: $('#username').val(),
                    password: $('#password').val(),
                  },
                  success: function (data) {
                    if (data.errno==0) {
                      if (data.data.url) {

                        toastr.success(data.data.name + ' 页面即将自动跳转~');
                      }else{
                        toastr.success(data.data.name);
                      }
                      setTimeout(function(){
                        $(self).removeClass('disabled').prop('disabled',false);
                        if (data.data.url) {
                          location.href=data.data.url;
                        }else if( $(this).hasClass('no-refresh')){
                          toastr.clear()
                        }else{
                          location.reload();
                        }
                      },1500);
                    }else{
                      toastr.error(data.errmsg);

                      //console.log(data);
                      setTimeout(function(){
                        $(self).removeClass('disabled').prop('disabled',false);
                        if (data.data) {
                          location.href=data.data;
                        }else{
                          toastr.clear()
                        }
                      },1500);
                    }
                  }
                });
                return false;
              })
            </script>
            {%endif%}

        </section>
    </div>
</section>
<!-- footer -->
<footer id="footer">
    <div class="text-center padder">
        <p>
                <small>CmsWing网站内容管理框架<br>&copy; 2015 - <script>document.write(new Date().getFullYear())</script></small>
        </p>
    </div>
</footer>
<!-- / footer -->
</body>
</html>
